var __extends =
    (this && this.__extends) ||
    (function () {
      var e = function (t, i) {
        return (e =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (e, t) {
              e.__proto__ = t;
            }) ||
          function (e, t) {
            for (var i in t)
              Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i]);
          })(t, i);
      };
      return function (t, i) {
        function r() {
          this.constructor = t;
        }
        if ("function" != typeof i && null !== i)
          throw new TypeError(
            "Class extends value " + String(i) + " is not a constructor or null"
          );
        e(t, i),
          (t.prototype =
            null === i
              ? Object.create(i)
              : ((r.prototype = i.prototype), new r()));
      };
    })(),
  RecoverDetailView = (function (e) {
    function t() {
      var t = e.call(this) || this;
      return (
        (t.max = 99),
        (t.min = 1),
        (t.step = 1),
        (t.num = 1),
        t.btn_recDetailCancle.on(Laya.Event.CLICK, t, t.onRecoverCancle),
        (t.btn_recover_huishou.label = "回收"),
        (t.btn_recover_huishou.skin = "comp/commonpic/btn_dialog_sure.png"),
        t.btn_recover_huishou.on(Laya.Event.CLICK, t, t.onYaoPinHuiShouFn),
        WebSocketService.addListener({
          caller: t,
          code: 1252,
          method: t.onLoadReceiverData,
        }),
        t.btn_recover_plus.on(Laya.Event.CLICK, t, t.onDidRecoverClick),
        t.btn_recover_dele.on(Laya.Event.CLICK, t, t.onDidRecoverClick),
        t.slider_recover.on(Laya.Event.CHANGE, t, t.sliderChange),
        t
      );
    }
    return (
      __extends(t, e),
      (t.prototype.onDidRecoverClick = function (e) {
        "item1" == e.target.name
          ? ((this.num = this.num + this.step),
            this.num > this.max && (this.num = this.max),
            (this.slider_recover.value = this.num))
          : "item0" == e.target.name &&
            ((this.num = this.num - this.step),
            this.num < this.min && (this.num = this.min),
            (this.slider_recover.value = this.num)),
          this.updateMedicalData();
      }),
      (t.prototype.sliderChange = function () {
        (this.num = this.slider_recover.value), this.updateMedicalData();
      }),
      (t.prototype.updateMedicalData = function () {
        (this.label_recover_num.text = this.num + ""),
          (this.label_recover_money.text = this.num * this.price + "");
      }),
      (t.showRecDetailView = function (e, i, r) {
        null == this.recDetailView &&
          ((this.recDetailView = new t()), (this.recDetailView.zOrder = 1e3)),
          this.recDetailView.popup(!0),
          (this.recDetailView.medical_id = e);
        var o = e;
        o > 298 ? (o -= 282) : o > 279 && (o -= 279),
          (this.recDetailView.price =
            o > 16
              ? Dictionary.powerDict[o].bloPrice / 2
              : Dictionary.medicaDict[o].bloPrice / 2),
          (this.recDetailView.recover_title.text = r),
          (this.recDetailView.label_recover_money.text =
            this.recDetailView.price + ""),
          (this.recDetailView.max = i),
          (this.recDetailView.slider_recover.max = this.recDetailView.max),
          (this.recDetailView.slider_recover.min = 1),
          (this.recDetailView.slider_recover.value = 1),
          (this.recDetailView.label_recover_num.text = "1");
      }),
      (t.prototype.onLoadReceiverData = function (e) {
        8 == e.code &&
          (ToastView.toastView(e.msg),
          WebSocketService.send({ c: 1416, d: { pageNum: 0 } }));
      }),
      (t.prototype.onYaoPinHuiShouFn = function () {
        var e = this.num;
        WebSocketService.send({
          c: 1252,
          d: { gid: this.medical_id, count: e },
        });
      }),
      (t.prototype.onRecoverCancle = function () {
        this.close();
      }),
      (t.close = function () {
        this.recDetailView && this.recDetailView.close();
      }),
      t
    );
  })(ui.HospitalController.RecoverDetailViewUI);
